use strict;


=head1 NAME

  RTx::AssetTracker::User -- Class Description
 
=head1 SYNOPSIS

  use RTx::AssetTracker::User

=head1 DESCRIPTION


=head1 METHODS

=cut

package RTx::AssetTracker::User;

use vars qw( @ISA );
@ISA= qw(RT::User);

use RTx::AssetTracker::Principal;
# {{{ sub CurrentUserHasRight

=head2 CurrentUserHasRight

  Takes a single argument. returns 1 if $Self->CurrentUser
  has the requested right. returns undef otherwise

=cut

sub CurrentUserHasRight {
    my $self  = shift;
    my $right = shift;

    return ( $self->CurrentUser->HasRight(Right => $right, Object => $RTx::AssetTracker::System) );
}

# }}}

sub PrincipalObj {
    my $self = shift;
    unless ($self->{'PrincipalObj'} &&
            ($self->{'PrincipalObj'}->ObjectId == $self->Id) &&
            ($self->{'PrincipalObj'}->PrincipalType eq 'User')) {

            $self->{'PrincipalObj'} = RTx::AssetTracker::Principal->new($self->CurrentUser);
            $self->{'PrincipalObj'}->LoadByCols('ObjectId' => $self->Id,
                                                'PrincipalType' => 'User') ;
            }
    return($self->{'PrincipalObj'});
}



1;
